#include<bits/stdc++.h>
using namespace std;
const int N=1e5+105,qwq=1e5;
long long n,m,ans,dp[N],w,top,top1,ans1;
struct node{
	long long w,t,c;
}a[85],po[N];
bool cmp(node i,node j)
{
	return j.w*i.t<i.w*j.t;
}
int main()
{
	freopen("book.in","r",stdin);
	freopen("book.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i)
		cin>>a[i].c;
	for(int i=1;i<=n;++i)
		cin>>a[i].t;
	for(int i=1;i<=n;++i)
		cin>>a[i].w;
	cin>>m;
	sort(a+1,a+n+1,cmp);
	top=n+1;
	for(int i=1;i<=n;++i)
	{
		if(m-a[i].c*a[i].t>qwq)
			m-=a[i].c*a[i].t,ans1+=a[i].w*a[i].c;
		else
		{
			w=(m-qwq)/a[i].t;
			top=i;
			if(w<=0) break;
			ans1+=w*a[i].w;
			m-=w*a[i].t;
			a[i].c-=w;
			break;
		}
	}
	for(int i=top;i<=n;++i)
	{
		for(int j=0;(1<<j)<=a[i].c;++j)
		{
			++top1;
			po[top1].t=(1<<j)*a[i].t;
			po[top1].w=(1<<j)*a[i].w;
			a[i].c-=(1<<j);
		}
		if(a[i].c!=0)
			++top1,po[top1].t=a[i].c*a[i].t,po[top1].w=a[i].c*a[i].w; 
	}
	for(int i=1;i<=top1;++i)
	{
		for(int j=0;j<=m-po[i].t;++j)
			dp[j]=max(dp[j+po[i].t]+po[i].w,dp[j]);
	}
	for(int i=0;i<=m;++i)
		ans=max(dp[i],ans);
	cout<<ans+ans1;
	return 0;
}
